package com.app.controller;


import com.app.common.Result;
import com.app.service.IDistributionRecordsService;
import com.app.vo.DistributionRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 发放记录 前端控制器
 * </p>
 *
 * @author yoominic
 * @since 2024-06-22
 */
@RestController
@RequestMapping("/distributionRecords")
public class DistributionRecordsController {
    @Autowired
    private IDistributionRecordsService distributionRecordsService;

    @GetMapping("/getDistributionRecordsByBusinessId")
    public Result getDistributionRecordsByBusinessId(@RequestParam(defaultValue = "0") Integer page,
                                                     @RequestParam(defaultValue = "10") Integer limit, String dateLimit, Integer business, Integer integralDistributionType) throws Exception {
        DistributionRecordVo vo = distributionRecordsService.getDistributionRecordsByBusinessId(page, limit, dateLimit, business, integralDistributionType);
        return Result.success(vo);
    }

    /**
     * 根据发放记录Id删除发放记录
     *
     * @param id
     * @return
     * @throws Exception
     */
    @DeleteMapping("/deleteDistributionRecordsById/{Id}")
    public Result deleteDistributionRecordsByBusinessId(@PathVariable Integer id) throws Exception {
        return distributionRecordsService.deleteDistributionRecordsById(id);
    }
}

